// using subscribe-publish pattern, aka event bus or broker
define([], function () {
	// Prepare the question data for the list view.
	let minifyQuestion = function (question) {
		// Strip HTML tags from body using JQuery.
		question.body = $(question.body).text();
		// Trim the body at 200 chars adding ellipsis.
		if (question.body.length > 200) {
			question.body = question.body.substring(0, 200) + '...';
		}
		// Return the updated question object.
		return question;
	};

	// Expose the functions needed by other compoents.
	return {
		minifyQuestion
	};
});